package com.weibo4j.api.req.comment;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.weibo4j.api.WeiboRequest;
import com.weibo4j.api.annotation.Param;
import com.weibo4j.api.response.comment.SingleCommentResponse;
import com.weibo4j.api.util.RequestType;

public class CommentAddRequest extends WeiboRequest<SingleCommentResponse> {

    private String comment;
    
    private Long id;
    
    private Integer commentOri;
    
    private Long cid;
    
    private Integer withoutMention;
    
    public Long getCid() {
        return cid;
    }

    public void setCid(Long cid) {
        this.cid = cid;
    }

    @Param("without_mention")
    public Integer getWithoutMention() {
        return withoutMention;
    }

    public void setWithoutMention(Integer withoutMention) {
        this.withoutMention = withoutMention;
    }


    public String getComment() {
        if (comment != null) {
            try {
                return URLEncoder.encode(comment, "utf-8");
            } catch (UnsupportedEncodingException e) {
            }
        }
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Param("comment_ori")
    public Integer getCommentOri() {
        return commentOri;
    }

    public void setCommentOri(Integer commentOri) {
        this.commentOri = commentOri;
    }

    @Override
    public RequestType requestType() {
        return RequestType.POST;
    }

    @Override
    public String baseUrl() {
        return "https://api.weibo.com/2/comments/create.json";
    }

    @Override
    public Class<SingleCommentResponse> responseType() {
        return SingleCommentResponse.class;
    }
}
